<?php
$isReloadable = false;
require_once "../../../pers/inc.config.php";
require_once OVF_FS_WEB_ROOT.'/app/_inc/inc.session.php';
require_once OVF_FS_WEB_ROOT.'/app/_inc/funct.html.php';
require_once '../_inc/class.wfmModulo.php';
require_once '../_inc/class.wfmPagina.php';


$oMod = new wfmModulo(reqVarInt('id'));
if ($oMod->codModulo == "") {
	backOnErr("id.modulo '".reqVar('id')."' errato");
	exit;
}
$idModulo = $oMod->idModulo;
$codModulo = $oMod->codModulo;

$sSql = "SELECT r.* FROM wfm_rec_$codModulo r WHERE r.id_rec = ".reqVarInt('idr');
$objDB->query($sSql,'selRecX');
$aRec = $objDB->fetch('selRecX');
if (!$aRec) {
	backOnErr("id_rec '".reqVar('idr')."' errato");
	exit;
}

$oPag = new wfmPagina($oMod,$aRec['id_pagina'],'pag');
if ($oPag->codModulo == "") {
	backOnErr("id_pagina '".$aRec['id_pagina']."' errato");
	exit;
}

$oMod = &$oPag->oMod;
$oPag->prepMod($aRec);

if (reqVar('azione') == 'submCmd') {
	$msgPag = $oPag->eseguiMod();
} 


$sCmdR = $oPag->getHtmlComandi();
$sCmdR .= cmdTorna();

testaHtml($oMod->titolo,'Registrazione in lavorazione',$msgPag,'wfma');
?>
<script type="text/javascript">
<!--
function submCmd(id,cmd) {
	document.frm1.X_id_comando.value = id;
	document.frm1.X_comando.value = cmd;
	document.frm1.azione.value = 'submCmd';
	document.frm1.submit();
}
//-->
</script>
<table border="0" cellpadding="3" cellspacing="1" width="100%" align='center'>
   <tr>
      <td class="cmd1" align="right">
			<? echo  $sCmdR;?>
      </td>
   </tr>
</table>
<?
echo getHtmlForm('frm1','',array('enctype'=>true));
echo getHtmlHidden('azione','...');
echo getHtmlHidden('id');
echo getHtmlHidden('idr');
echo getHtmlHidden('X_id_modulo',$oPag->idModulo);
echo getHtmlHidden('X_id_pagina',$oPag->idPagina);
echo getHtmlHidden('X_id_comando',0);
echo getHtmlHidden('X_comando','');
echo getHtmlHidden('xsn',XSN);

$sHtml = $oPag->getHtmlPagina('mod');
if (substr($sHtml,0,10)=='@@include=') {
	include substr($sHtml,10);
} else {
	echo $sHtml;
}
?>
<table border="0" cellpadding="3" cellspacing="1" width="100%" align='center'>
   <tr>
      <td class="cmd1" align="right">
         <? echo  $sCmdR;?>
      </td>
   </tr>
</table>
<?
echo "</form>\n";
codaHtml();
exit();
